package com.hfzy.ihk.facade.linkcall.enums;

import com.hfzy.ihk.common.facade.elasticsearch.entity.ElasticsearchTable;
import com.hfzy.ihk.facade.linkcall.entity.TestEntity;
import com.hfzy.ihk.facade.linkcall.entity.TestLog;
import com.hfzy.ihk.facade.linkcall.entity.flow.config.SpeakingFlow;
import com.hfzy.ihk.facade.linkcall.entity.flow.config.SpeakingFlowStep;
import com.hfzy.ihk.facade.linkcall.entity.flow.config.SpeakingPackage;
import com.hfzy.ihk.facade.linkcall.entity.task.CallTask;
import com.hfzy.ihk.facade.linkcall.entity.task.CallTaskPhone;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/7/19.
 *
 * @author wws
 */
public enum  LinkCallTables implements ElasticsearchTable {

    TEST_ENTITY(TestEntity.class.getName(), "xxxx"),
    TEST_LOG(TestLog.class.getName(), "xxx"),
    CALL_TASK(CallTask.class.getName(), ""),
    CALL_TASK_PHONE(CallTaskPhone.class.getName(), ""),
    SPEAKING_PACKAGE(SpeakingPackage.class.getName(), ""),
    SPEAKING_FLOW(SpeakingFlow.class.getName(), ""),
    SPEAKING_FLOW_STEP(SpeakingFlowStep.class.getName(), ""),
            ;


    private LinkCallTables(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private String value;

    private String desc;

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String getTableName() {
        return value;
    }

    private static Map<String, LinkCallTables> map = new HashMap<>();
    static {
        for (LinkCallTables value : LinkCallTables.values()) {
            map.put(value.getValue(), value);
        }
    }

    public static LinkCallTables fromValue(String value) {
        LinkCallTables ret = map.get(value);
        if (ret != null) {
            return ret;
        } else {
            throw new IllegalArgumentException("No enum const " + LinkCallTables.class + "." + value);
        }
    }

}
